<extend name="Public/base" />
<block name="body">
<div class="m-tab s-tab">
	<h2 class="u-tt">文章栏目</h2>
	<ul class="u-tabs">
		<li><a href="{:U('index')}">栏目列表</a></li>
		<li><a href="#tab1" class="tab-on tab-a">{$actionName}文章栏目</a></li>
	</ul>
</div>
<div class="m-form">
	<form action="{:U('updateHook')}" method="post" id="form">
		<fieldset>
			<div id="tab1">
				<div class="formitm">
					<label class="lab">钩子类型：</label>
					<div class="ipt">
						<select class="u-slt" name="type" datatype="*">
							<volist name=":C('HOOKS_TYPE')" id="vo">
								<option value="{$key}" <eq name="info.type" value="$key"> selected</eq>>{$vo}</option>
							</volist>
						</select>
						<span>区分钩子的主要用途</span>
						<p></p>
					</div>
				</div>
				<div class="formitm">
					<label class="lab">钩子名称：</label>
					<div class="ipt">
						<input name="name" type="text" class="u-ipt u-ipt-6" value="{$info.name}" datatype="s1-20" errormsg="钩子名称至少1~20个字符！" placeholder="需要在程序中先添加钩子，否则无效"/>
						<p></p>
					</div>
				</div>
				<div class="formitm">
					<label class="lab" >钩子描述：</label>
					<div class="ipt">
						<textarea name="description" id="description" class="u-tta u-tta-6" placeholder="钩子的描述信息">{$info.description}</textarea>
					</div>
				</div>


		<present name="info">
			<div class="formitm">
				<label class="item-label">钩子挂载的插件排序<span class="check-tips">（拖动后保存顺序，影响同一个钩子挂载的插件执行先后顺序）</span></label>
				<div class="controls">
					<input type="hidden" name="addons" value="{$info.addons}" readonly>
					<empty name="info.addons">
						暂无插件，无法排序
					<else />
					<ul id="sortUl" class="dragsort">
						<volist name=":explode(',',$info['addons'])" id="addons_vo">
							<li class="getSort"><b>&times;</b><em>{$addons_vo}</em></li>
						</volist>
					</ul>
					<script type="text/javascript">
						$(function(){
							$("#sortUl").dragsort({
	                            dragSelector:'li',
	                            placeHolderTemplate: '<li class="draging-place">&nbsp;</li>',
	                            dragEnd:function(){
	                            	updateVal();
	                            }
	                        });

							$('#sortUl li b').click(function(){
                            	$(this).parent().remove();
                            	updateVal();
                            });

							// 更新排序后的隐藏域的值
	                        function updateVal() {
	                        	var sortVal = [];
                            	$('#sortUl li').each(function(){
                            		sortVal.push($('em',this).text());
                            	});
                                $("input[name='addons']").val(sortVal.join(','));
	                        }
						})
					</script>
					</empty>
				</div>
			</div>
		</present>


			</div>
			<div class="formitm formitm-1  formitm-2">
				<input name="id" type="hidden" value="{$info.id|default=''}" />
				<button class="u-btn" type="submit">保存</button>
				<button class="u-btn s-btn-c3" type="reset">重置</button>
				<span class="status" id="status"></span>
			</div>
		</fieldset>
	</form>
</div>
<style type="text/css">
.controls {
	overflow: hidden;
	padding: 5px 5px 5px 0;
}
.controls label + label {
	margin-left: 15px;
}
.controls .check-tips {
	margin-left: 20px;
	color: #999;
}	
</style>
</block>
<block name="script">
<script>
Do.ready('base','form','dialog','color','editor','sort','upload','tabs',function() {
	//表单综合处理
	$('#form').duxFormPage({
		returnUrl:"{:U('hooks')}"
	});

	{// 插件列表}

});
</script>
</block>